<?php

use yii\helpers\Inflector;
use yii\helpers\StringHelper;

/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\crud\Generator */

$urlParams = $generator->generateUrlParams();

$baseName = Inflector::camel2id(StringHelper::basename($generator->modelClass));

echo "<?php\n";
?>

use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model <?= ltrim($generator->modelClass, '\\') ?> */

?>


<div class="<?= $baseName ?>-view view-block">

    <?= "<?= " ?>DetailView::widget([
		'model' => $model,
		'options' => ['class' => 'layui-table'],
		'attributes' => [
		<?php
		if (($tableSchema = $generator->getTableSchema()) === false) {
			foreach ($generator->getColumnNames() as $name) {
				echo "            '" . $name . "',\n";
			}
		} else {
			foreach ($generator->getTableSchema()->columns as $column) {
				$format = $generator->generateColumnFormat($column);
				echo "            '" . $column->name . ($format === 'text' ? "" : ":" . $format) . "',\n";
			}
		}
		?>
		],
    ]) ?>

</div>
